<template>
  <el-descriptions
    ref="ruleFormRef"
    :column="2"
    direction="vertical"
    v-loading="isLoading"
  >
    <el-descriptions-item width="50%" :label="titles.unityName">
      {{ isNullOrEmpty( formInline?.unityName ) }}
    </el-descriptions-item>
    <el-descriptions-item width="50%" :label="titles.projectName">
      {{ isNullOrEmpty( formInline?.projectName ) }}
    </el-descriptions-item>
    <el-descriptions-item width="50%" :label="titles.productName">
      {{ isNullOrEmpty( formInline?.productName ) }}
    </el-descriptions-item>
    <el-descriptions-item width="50%" :label="titles.taskName">
      {{ isNullOrEmpty( formInline?.taskName ) }}
    </el-descriptions-item>
    <el-descriptions-item width="50%" :label="titles.projectName">
      {{ isNullOrEmpty( formInline?.projectName ) }}
    </el-descriptions-item>
    <el-descriptions-item width="50%" :label="titles.status">
      {{ isNullOrEmpty( STRATEGYSTATUSTEXT[formInline?.status]?.label ) }}
    </el-descriptions-item>
    <el-descriptions-item width="50%" :label="titles.cycle">
      {{ isNullOrEmpty( PERIODUNITTEXT[formInline?.cycle]?.label ) }}
    </el-descriptions-item>
    <el-descriptions-item width="50%" :label="titles.deviceIds">
      {{ isNullOrEmpty( formInline?.deviceIds ) }}
    </el-descriptions-item>
  </el-descriptions>
</template>

<script setup lang="ts">
import { isNullOrEmpty } from '@/utils/functions'
import {
  STRATEGYSTATUS,
  STRATEGYSTATUSTEXT
} from "@/constant/device-mangenment";
import { PERIODUNITTEXT } from "@/constant/dayly-inspection";
import { ref } from "vue";
import { titles } from "./index";
import type { infoType } from "@/api/operate/timed-tasks/index";
type FormProps = {
  formInline: infoType;
  isLoading: boolean;
};

const props = withDefaults(defineProps<FormProps>(), {
  formInline: () => ({}) as infoType,
  isLoading: false
});

const ruleFormRef = ref();
//  const newFormInline = ref(props.formInline as any);
//
//
//  watch(()=>props.formInline,()=>{
//  	newFormInline.value = props.formInline
//  },{
//  	deep:true,
//  	immediate:true
//  })

function getRef() {
  return ruleFormRef.value;
}

defineExpose({ getRef });
</script>
